home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Original Shareware 1.1
/
The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso
/
19
/
madtrb11.zip
/
COPY.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1985-07-13
|
2KB
|
51 lines
PROGRAM Copy;
{
This program will copy any text file, including Pascal files,
to a new file with the designated name.
Source: "COPY and List for Pascal Source Files", TUG Lines Volume I Issue 6
Author: Harold Drake
Application: All systems
}
var
source: string[14]; {name of source file}
target: string[14]; {name of target file}
line: string[80]; {one line of the file}
n: integer; {index variable}
lgth: integer; {length of filename string}
f: text; {internal filename for source}
g: text; {internal filename for target}
pascal: boolean; {flag for pascal file extension}
begin
write('Enter source name: '); readln(source);
pascal := true;
lgth := length(source);
for n := 1 to lgth do if source[n] = '.' then pascal := false;
if pascal then insert('.PAS',source,1+lgth);
if (not pascal) and (source[lgth] = '.') then delete(source,lgth,1);
assign(f,source);
write('Enter target name: ');readln(target);
pascal := true;
lgth := length(target);
for n := 1 to lgth do if target[n] = '.' then pascal := false;
if pascal then insert('.PAS',target,1+lgth);
if (not pascal) and (target[lgth] = '.') then delete(target,lgth,1);
assign(g,target);
reset(f);
rewrite(g);
while not eof(f) do
begin
readln(f,line);
writeln(g,line);
end;
close(g);
close(f);
end.